﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace Jogo_Grupo2.Elementos 
{
    class Cabana : Objeto2D
    {
        public float energiaCabana = 1000f;

        public bool invulneravel = true;

        public Cabana(Texture2D textura,Vector2 posicao):base(textura,posicao)
        {
            this.texture = texture;
            this.position = posicao;

        }

        public override void Update(GameTime gameTime)
        {


            base.Update(gameTime);

        }

        public void perdeEnergiaCabana()
        {
            int timerDano = 0;
            if (this != null)
            {
                invulneravel = false;
                Console.WriteLine("energia: " + energiaCabana);


                if (timerDano == 3)
                {
                    energiaCabana -= 0.1f;


                }
                else if (timerDano == 0)
                {
                    timerDano++;
                    this.energiaCabana -= 0.1f;
                }

            }

        }

        public bool verificarDestruiuCabana()
        {
            if (this.energiaCabana == 0)
            {
                return true;
            }

            else
                return false;
        }
        public override void Draw(SpriteBatch spriteBatch)
        {
            spriteBatch.Draw(texture,new Vector2(position.X,position.Y),Color.White);
        }

    }
}
